<layout name="page" />
<block name="content">
	{:widget('page_header/search',array('name'=>'常用语'))}
	<div class="operate-panel">
		<a class="btn btn-del" onclick="del()">删除</a>
		<i class="mid"></i>
		<a class="btn btn-normal" onclick="add()">新建</a>
	</div>
	<div class="sub">
		<div class="table">
			<ul>
				<li class="thead">
					<span class="w3"><label class="checkbox">
							<input type="checkbox"class="toggle-select-all" data="id[]" />
							<i class="icon"></i> </label></span>
					<span class="w19 x1">常用语</span>
				</li>
				<if condition="empty($list)">
					<li class="no-data">
						没找到数据
					</li>
				</if>
				<form method="post" action="" id="form_data">
					<foreach name="list" val="vo">
						<li class="tbody">
							<span class="w3"><label class="checkbox">
									<input  type="checkbox" name="id[]" value="{$vo.id}" />
									<i class="icon"></i></label> </span>
							<span class="w19 x1"><a href="{:url('edit','id='.$vo['id'])}">{$vo.name} </a></span>
						</li>
					</foreach>
				</form>
			</ul>
		</div>
		<if condition="!empty($list)">
			{$page}
		</if>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;
			var fn = {
				del : function() {
					if ($("input[name='id[]']:checked").length == 0) {
						layer.msg('请选择要删除的项目');
						return false;
					}
					//信息框-例2
					layer.msg('确定要删除吗?', {
						time : 0,
						btn : ['确定', '取消'],
						yes : function(index) {
							var vars = $("#form_data").serialize();
							send_ajax("{:url('del')}", vars, function(ret) {
								if (ret.status) {
									layer.msg(ret.info, function() {
										location.reload(true);
									});
								}
							});
						},
						no : function(index) {
							layer.close(index);
						}
					});
				},
				add : function() {
					window.open("{:url('add')}", "_self");
				},
			};
			win_exp(fn);

			set_return_url(null);
		});
	</script>
</block>